package com.server.http.handler.impl;

import com.server.conditionenum.HttpReturnStatus;
import com.server.db.DataBaseManager;
import com.server.http.handler.HttpHandler;
import com.server.http.request.HttpRequestMessage;
import com.server.http.response.HttpResponseMessage;
import com.server.mine.net.HttpProtocol;

/**
* @author	李小布
* @email	397554852@qq.com
* @version	创建时间：2018年9月25日 下午12:15:45
*/
public class GetAppResList extends HttpHandler{

	@Override
	public void handle(HttpRequestMessage request, HttpResponseMessage response) {
		
		int power = 0;
		int uid = 0;
		String json = null;
		
		try {
			power = Integer.parseInt(request.getParameter("power"));
			uid = Integer.parseInt(request.getParameter("uid"));
			if(power >= 10) {
				json = DataBaseManager.GetInstance().GetAppList();
			}else {
				json = DataBaseManager.GetInstance().GetAppResList(uid);
			}
		}catch (Exception e) {
			e.printStackTrace();
		}
		SetReturnData(response,json,HttpProtocol.GETAPPLIST,HttpReturnStatus.Successed);
	}
}